package com.wzb.mybatisplus.bitaction.electrumaction;

import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;

public class ConnectionTest {
    public static void main(String[] args) {
        String[] servers = {
                "electrum.bitaroo.net:50002",
                "electrumx.42w.io:50002",
                "blackie.c3-soft.com:50002",
                "electrum.emzy.de:50002"
        };

        for (String server : servers) {
            String[] parts = server.split(":");
            String host = parts[0];
            int port = Integer.parseInt(parts[1]);

            System.out.println("测试连接: " + host + ":" + port);

            try {
                SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
                SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
                socket.setSoTimeout(5000);

                System.out.println("✓ 连接成功");
                socket.close();

            } catch (Exception e) {
                System.out.println("✗ 连接失败: " + e.getMessage());
            }
            System.out.println("---");
        }
    }
}